package cn.tiancaifan.micro.service;


import cn.tiancaifan.micro.entity.Position;
import cn.tiancaifan.micro.mapper.PositionMapper;
import cn.tiancaifan.micro.utils.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class PositionService {

    @Autowired
    PositionMapper positionMapper;

    public List<Position> getAllPositons() {
        return positionMapper.getAllPositions();
    }

    @Logger("添加职位")
    public int addPosition(Position position) {
        position.setEnabled(true);
        position.setCreateDate(new Date());
        return positionMapper.addPosition(position);
    }

    @Logger("修改职位")
    public int updataPosition(Position position) {
        return positionMapper.updataPosition(position);
    }

    @Logger("删除职位")
    public int deletePositionById(Integer id) {
        return positionMapper.deletePositionById(id);
    }

    @Logger("批量删除职位")
    public int deletePositionsByIds(Integer[] ids) {
        return positionMapper.deletePositionsByIds(ids);
    }
}
